package io;

import java.io.*;

public class CopyDemo4 {
    public static void main(String[] args) {
        try(FileInputStream fis = new FileInputStream("ideaIU-2021.1.3.exe");
            FileOutputStream fos = new FileOutputStream("copy4.exe");
            BufferedInputStream bis = new BufferedInputStream(fis);
            BufferedOutputStream bos = new BufferedOutputStream(fos)
           ) {
            int len;
            long lg = System.currentTimeMillis();
            byte[] a = new byte[1024*1000];
            while ((len=bis.read(a))!=-1){
                bos.write(a,0,len);
            }
            long lg1 = System.currentTimeMillis();
            System.out.println("耗时"+(lg1-lg)+"ms");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
